<div class="am-g">
    <!-- Row start -->
    <div class="am-u-sm-12">
        <div class="card-box">
            <form action="" class="am-form"  data-am-validator id="doc-vld-msg">
                <fieldset>
                    <legend>添加仓库</legend>
                    <div class="am-form-group am-form-group-sm">
                        <label for="doc-vld-name-2">仓库名：</label>
                        <input type="text" name="name" class="am-form-field" id="fname" placeholder="仓库名称"/>
                    </div>
                    
                    <button class="am-btn am-btn-secondary" type="button">提交</button>
                </fieldset>
            </form>


        </div>
    </div>
    <!-- Row end -->
</div>
</div>
</div>
<script>
    var _url="/depot/add"
    $(".am-btn").on("click",function(){
        var name=$("#fname").val();
        if(name.length<1){
            alert("仓库名称不能为空！")
            return
        }
        $.post(_url,{name:name},function(data){
            if(data.status==1){
                alert("添加成功")
                window.location.href=data.url
            }else{
                alert(data.msg);
            }
        },"json");
    });
</script>